# include <bits/stdc++.h>

const int32_t maxn = 1000005;

const int32_t inf  = 19198100;

const int32_t lim  = 1000000;

namespace Fastio {
	#define USE_FASTIO 1
	#define IN_LEN 450000
	#define OUT_LEN 450000
	char ch, c; int len;
	short f, top, s;
	inline char Getchar() {
		static char buf[IN_LEN], *l = buf, *r = buf;
		if (l == r) r = (l = buf) + fread(buf, 1, IN_LEN, stdin);
		return (l == r) ? EOF : *l++;
	}
	char obuf[OUT_LEN], *ooh = obuf;
	inline void Putchar(char c) {
		if (ooh == obuf + OUT_LEN) fwrite(obuf, 1, OUT_LEN, stdout), ooh = obuf;
		*ooh++ = c;
	}
	inline void flush() { fwrite(obuf, 1, ooh - obuf, stdout); }

	#undef IN_LEN
	#undef OUT_LEN
	struct Reader {
		template <typename T> Reader& operator >> (T &x) {
			x = 0, f = 1, c = Getchar();
			while (!isdigit(c)) { if (c == '-') f *= -1; c = Getchar(); }
			while ( isdigit(c)) x = (x << 3) + (x << 1) + (c ^ 48), c = Getchar();
			x *= f;
			return *this;
		}
		inline Reader& operator >> (char &c) {
            c = Getchar();
            while (c == ' ' || c == '\n' || c == '\r') c = Getchar();
            return *this;
        }
		Reader() {}
	} cin;
	const char endl = '\n';
	struct Writer {
		typedef long long mxdouble;
		template <typename T> Writer& operator << (T x) {
			if (x == 0) { Putchar('0'); return *this; }
			if (x < 0) Putchar('-'), x = -x;
			static short sta[40];
			top = 0;
			while (x > 0) sta[++top] = x % 10, x /= 10;
			while (top > 0) Putchar(sta[top] + '0'), top--;
			return *this;
		}
		Writer& operator << (const char *str) {
			int cur = 0;
			while (str[cur]) Putchar(str[cur++]);
			return *this;
		}
		inline Writer& operator << (char c) {Putchar(c); return *this;}
		Writer() {}
		~ Writer () {flush();}
	} cout;
	#define cin Fastio::cin
	#define cout Fastio::cout
	#define endl Fastio::endl
}

std::multiset <int32_t> lp, rp, lr[maxn], rl[maxn];

inline int32_t minval (const std::multiset <int32_t> & x) {
	return * x.begin ();
}

inline int32_t maxval (const std::multiset <int32_t> & x) {
	return * x.rbegin ();
}

int32_t n;
char x;

namespace segtree {
	
	struct node {
		int32_t l, r, w;
	} t[maxn << 2];
	
	# define m ((l + r) >> 1)
	# define lc (x << 1)
	# define rc (x << 1 | 1)

	inline void build (const int32_t l = 1, const int32_t r = lim, const int32_t x = 1) {
		if (l == r) return t[x] = {- inf, + inf, inf << 1}, void ();
		build (l, m, lc), build (m + 1, r, rc);
		
		t[x].l = std::max (t[lc].l, t[rc].l);
		t[x].r = std::min (t[lc].r, t[rc].r);
		t[x].w = std::min ({t[lc].w, t[rc].w, t[rc].r - t[lc].l});
	}
	
	inline void opt_mod (const int32_t p, const int32_t l = 1, const int32_t r = lim, const int32_t x = 1) {
		if (l == r) {
			t[x].l = rl[p].empty () ? - inf : maxval (rl[p]);
			t[x].r = lr[p].empty () ? + inf : minval (lr[p]);
			return t[x].w = t[x].r - t[x].l, void ();
		}
		p <= m ? opt_mod (p, l, m, lc) : opt_mod (p, m + 1, r, rc); 
		
		t[x].l = std::max (t[lc].l, t[rc].l);
		t[x].r = std::min (t[lc].r, t[rc].r);
		t[x].w = std::min ({t[lc].w, t[rc].w, t[rc].r - t[lc].l});
	}
		
}

using namespace segtree;

int main () {
	
	freopen ("stone.in", "r", stdin);
	freopen ("stone.out", "w", stdout);
	
	cin >> n, segtree::build ();
	
	for (int i = 1, l, r; i <= n; ++ i) {
		
		cin >> x >> l >> r;
		
		if (x == 'A') 
			lp.insert (l), rp.insert (r), lr[l].insert (r), rl[r].insert (l);
		
		if (x == 'R') 
			lp.erase (lp.find (l)), rp.erase (rp.find (r)), lr[l].erase (lr[l].find (r)), rl[r].erase (rl[r].find (l));
		
		opt_mod (l), opt_mod (r);
		
		if (maxval (lp) < minval (rp))
			cout << minval (lr[maxval (lp)]) - maxval(rl[minval (rp)]) << '\n';
		else
			cout << t[1].w << '\n';
	}
	
	return 0;
}